﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace linkouqs.Gamekit {

    public abstract class CharacterAbility : MonoBehaviour {

        public CharacterController2D Character {
            get;
            protected set;
        }

        public bool IsInAnimation {
            get;
            protected set;
        }

        CharacterAbilityPush m_Push;

        protected virtual void Awake() {
            Character = GetComponent<CharacterController2D>();
            m_Push = GetComponent<CharacterAbilityPush>();
        }

        public virtual bool CanStartAction() {

            if(m_Push != null && m_Push.PushableObject != null) {
                return false;
            }

            return false == IsInAnimation;
        }

        public virtual void StartAction() {
            IsInAnimation = true;
        }

        public virtual void StopAction() {
            IsInAnimation = false;
        }

    }

}
